package com.jyw.custom.huaxi.mos.controller;

import com.jyw.common.core.domain.CommonResult;
import com.jyw.custom.huaxi.mos.service.IHuaxiMosService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

@RestController
@RequestMapping("/custom/huaxi/mos/login")
@Api(tags = "登录管理")
@Slf4j
public class HuaxiMosLoginController {

    @Resource
    private IHuaxiMosService huaxiMosService;

    /**
     * 登录方法
     *
     * @param code 授权码
     * @return 结果
     */
    @GetMapping("/login")
    @ApiOperation("授权登录")
    public CommonResult<String> wechatLogin(String code)
    {
        // 生成令牌
        String token = huaxiMosService.login(code);
//        ajax.put(Constants.TOKEN, token);
        return CommonResult.success(null,token);
    }
}
